package com.rr.mymoney.model.util;

import com.rr.mymoney.model.Account;
import com.rr.mymoney.model.Category;
import com.rr.mymoney.model.Currency;
import com.rr.mymoney.model.Transaction;
import com.rr.mymoney.security.SecurityUtils;

public class ModelFactory {

    public static Category newCategory() {
	Category category = new Category();
	category.setParentCategory(new Category());
	category.setUser(SecurityUtils.getLoggedUser());
	return category;
    }

    public static Transaction newTransaction() {
	Transaction transaction = new Transaction();
	transaction.setAccount(newAccount());
	transaction.setCategory(newCategory());
	transaction.setParentTransaction(new Transaction());
	transaction.setUser(SecurityUtils.getLoggedUser());
	return transaction;
    }

    public static Account newAccount() {
	Account account = new Account();
	account.setUser(SecurityUtils.getLoggedUser());
	account.setCurrency(new Currency());
	return account;
    }
}
